package service

import (
	"gitee.com/night-tc/gobige/logger"
	"gitee.com/night-tc/gobige/sess"
)

// 连接被关闭的时候
func (this *Service) SessClosed(sessmd sess.INetSess) {
	if !this.pendingSesses.CompareAndDelete(sessmd.GetID(), sessmd) {
		logger.Infof("SessClosed pendingSesses delete fail ID: %d Type: %d.", sessmd.GetID(), sessmd.GetType())
	} else {
		logger.Infof("SessClosed pendingSesses delete success ID: %d Type: %d.", sessmd.GetID(), sessmd.GetType())
	}
	if !this.clientSesses.CompareAndDelete(sessmd.GetID(), sessmd) {
		logger.Infof("SessClosed clientSesses delete fail ID: %d Type: %d.", sessmd.GetID(), sessmd.GetType())
	} else {
		logger.Infof("SessClosed clientSesses delete success ID: %d Type: %d.", sessmd.GetID(), sessmd.GetType())
	}
	this.NetSrv.SessClosed(sessmd)
}
